<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>合并对象，交换内容</title>
</head>
<body>
    <script>
        var a={name:'xm'},b=[4];
        var h=[];
      h= h.concat(a,b);
  
      a=h.splice(1,1);
      b=h.splice(0,1);
      document.write(a+'<br>');
      document.write(b+'<br>');
    </script>
</body>
</html>